package com.xmy.solution.service.impl;

import java.util.List;
import com.xmy.common.utils.DateUtils;
import com.xmy.common.utils.SecurityUtils;
import com.xmy.solution.domain.dto.homepagesolution.HomepageSolutionDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xmy.solution.mapper.HomepageSolutionMapper;
import com.xmy.solution.domain.HomepageSolution;
import com.xmy.solution.service.IHomepageSolutionService;

/**
 * 首页方案Service业务层处理
 * 
 * @author 夏明毅
 * @date 2024-12-30
 */
@Service
public class HomepageSolutionServiceImpl implements IHomepageSolutionService 
{
    @Autowired
    private HomepageSolutionMapper homepageSolutionMapper;

    /**
     * 查询首页方案
     * 
     * @param solutionId 首页方案主键
     * @return 首页方案
     */
    @Override
    public HomepageSolution selectHomepageSolutionBySolutionId(Long solutionId)
    {
        return homepageSolutionMapper.selectHomepageSolutionBySolutionId(solutionId);
    }

    /**
     * 查询首页方案列表
     * 
     * @param homepageSolution 首页方案
     * @return 首页方案
     */
    @Override
    public List<HomepageSolution> selectHomepageSolutionList(HomepageSolution homepageSolution)
    {
        return homepageSolutionMapper.selectHomepageSolutionList(homepageSolution);
    }

    @Override
    public List<HomepageSolutionDTO> selectHomepageSolutionDTOList(HomepageSolution homepageSolution) {
        return homepageSolutionMapper.selectHomepageSolutionDTOList(homepageSolution);
    }

    /**
     * 新增首页方案
     * 
     * @param homepageSolution 首页方案
     * @return 结果
     */
    @Override
    public int insertHomepageSolution(HomepageSolution homepageSolution)
    {
        homepageSolution.setCreateTime(DateUtils.getNowDate());
        homepageSolution.setCreateBy(SecurityUtils.getUsername());
        return homepageSolutionMapper.insertHomepageSolution(homepageSolution);
    }

    /**
     * 修改首页方案
     * 
     * @param homepageSolution 首页方案
     * @return 结果
     */
    @Override
    public int updateHomepageSolution(HomepageSolution homepageSolution)
    {
        return homepageSolutionMapper.updateHomepageSolution(homepageSolution);
    }

    /**
     * 批量删除首页方案
     * 
     * @param solutionIds 需要删除的首页方案主键
     * @return 结果
     */
    @Override
    public int deleteHomepageSolutionBySolutionIds(Long[] solutionIds)
    {
        return homepageSolutionMapper.deleteHomepageSolutionBySolutionIds(solutionIds);
    }

    /**
     * 删除首页方案信息
     * 
     * @param solutionId 首页方案主键
     * @return 结果
     */
    @Override
    public int deleteHomepageSolutionBySolutionId(Long solutionId)
    {
        return homepageSolutionMapper.deleteHomepageSolutionBySolutionId(solutionId);
    }
}
